<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    [v-cloak] {
      display: none;
    }
  </style>
</head>
<body>
  
  <div id="app" v-cloak>
    <button v-on:click="count++">点击-{{count}}</button>
    <button @click.once="changeCount">点击-{{count}}</button>
    <button @click="say('hello',$event)">点击传参</button>
    <a href="http://www.baidu.com" @click.prevent="say('hello',$event)">点我进入百度</a>
    <ul style="padding:20px;background:pink;" @click.capture="clickUl">
      <li style="height:50px;background:green;" @click="clickLi">11111</li>
    </ul>
    <input type="text" @keyup.enter="add">
  </div>

  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <script>
    // vue中数据事件绑定v-on:click  ---> @click  (@mousemove | @keyup)
    /* 
      事件修饰符 
        @click.prevent  取消了默认行为
    */
    const {createApp} = Vue
    createApp({
      data(){
        return {
          count:0
        }
      },
      methods:{
        add(event){
          // if(event.keyCode === 13){
            console.log(event.target.value)
          // }
        },
        clickUl(){console.log('ul....')},
        clickLi(){console.log('li....')},
        changeCount(event){
          this.count++
          console.log(event.target.tagName)
        },
        say(msg,event){
          alert(msg)
          // event.preventDefault()
        }
      }
    }).mount('#app')
    



  </script>
</body>
</html>